package com.vector.demo.controller.student;

import com.vector.demo.pojo.Assignment;
import com.vector.demo.service.AssignmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
@RequestMapping("/student")
public class StudentSubmitController {

    @Autowired
    AssignmentService assignmentService;

    @ResponseBody
    @RequestMapping("/submit")
    public String submit(int taskId, String taskStudent,String taskClass, String taskTeacher, String contents, Model model) {
        Assignment assignment = new Assignment();
        assignment.setAss_content(contents);
        assignment.setAss_student(taskStudent);
        assignment.setAss_teacher(taskTeacher);
        assignment.setAss_class(taskClass);
        assignment.setAss_task_id(taskId);
        assignmentService.addAssignment(assignment);
        return "1";
    }

}
